<!DOCTYPE html>

<html>
<#if root?exists>
<head>
<title>WebDesign Admin - Home</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<!-- bootstrap -->
<link href="${root.path}/css/bootstrap/bootstrap.css" rel="stylesheet" />
<link href="${root.path}/css/bootstrap/bootstrap-responsive.css" rel="stylesheet" />
<link href="${root.path}/css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet" />

<!-- libraries -->
<link href="${root.path}/css/lib/font-awesome.css" type="text/css" rel="stylesheet" />

<!-- global styles -->
<link rel="stylesheet" type="text/css" href="${root.path}/css/layout.css" />
<link rel="stylesheet" type="text/css" href="${root.path}/css/elements.css" />
<link rel="stylesheet" type="text/css" href="${root.path}/css/icons.css" />

<!-- this page specific styles -->
<link rel="stylesheet" href="${root.path}/css/compiled/tables.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${root.path}/css/compiled/index.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${root.path}/css/compiled/setdisplay.css" type="text/css" media="screen" />

<!-- open sans font -->
<link
	href='http://fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800'
	rel='stylesheet' type='text/css' />

<!-- lato font -->
<link
	href='http://fonts.useso.com/css?family=Lato:300,400,700,900,300italic,400italic,700italic,900italic'
	rel='stylesheet' type='text/css' />

<link rel="stylesheet" href="${root.path}/css/font-awesome.min.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>
	<!-- navbar -->
	<div class="navbar navbar-inverse">
		<div class="navbar-inner">
			<a class="brand" href="#">
				<img src="${root.path}/img/logo-login.png" />
			</a>
			<ul class="nav pull-right">
				<!--无序列表-->
				 <li>
                	<a href="${root.path}/admin/showTeachers">
                   	${root.username}
                	</a>
            	</li>
				<div class="copyrights"></div>

				<li class="hidden-phone">
                    <a href="#">修改密码</a>
                </li>

                <li class="hidden-phone">
                    <a href="${root.path}/common/logout">注销</a>
                </li>
			</ul>
		</div>
	</div>
	<!-- end navbar -->

	<!-- sidebar -->
	<div id="sidebar-nav">
		<ul id="dashboard-menu">
			<li>
				<a href="${root.path}/admin/showTeachers"> 
					<i class="icon-home"></i>
					<span>管理员主页</span>
				</a>
			</li>

			<li>
				<a class="dropdown-toggle" href="#"> 
					<i class="icon-asterisk"></i>
					<span>教师管理</span>
					<i class="icon-chevron-down"></i>
				</a>
				<ul class="submenu">
					<li><a href="${root.path}/admin/resetTeachersPwdShow">重置密码</a></li>
				</ul>
			</li>

			<li class="active">
				<div class="pointer">
					<div class="arrow"></div>
					<div class="arrow_border"></div>
				</div>
				<a class="dropdown-toggle" href="#"> 
					<i class="icon-edit"></i>
			 		<span>门户信息设置</span>
			 		<i class="icon-chevron-down"></i>
				</a>
				<ul class="submenu">
					<li><a href="${root.path}/admin/setBasicInfo">基本信息设置</a></li>
					<li><a href="${root.path}/admin/setDisplyShow">轮播展示</a></li>
				</ul>
			</li>

			<li>
				<a href="${root.path}/admin/showAllHomeworks">
				 	<i class="icon-list-alt "></i>
					<span>作业信息</span>
				</a>
			</li>
	</div>
	<!-- end sidebar -->


	<!-- main container -->
	<div class="content">
		<form action="#" method="post" id="form1">
		<div class="container-fluid">
			<!-- table sample -->
			<!-- the script for the toggle all checkboxes from header is located in js/theme.js -->
			<div class="table-products section">
				<div class="row-fluid">
					<#list root.dsplyhws as dsplyhw>
                    <div class="span3 img-container">
                    	<div class="img-box">
                                <span class="icon edit">
                                </span>
                                <span class="icon trash">
                                </span>
                            <a href="${dsplyhw.address}">
                            	<img class="img" src="${root.path}/img/testdisplay.jpeg" />
                            </a>
                            <p class="title">
                                <a href="${dsplyhw.address}">
                                <input name="display" type="checkbox" value=${dsplyhw.userhomeworkid}>
                                       	${dsplyhw.imgname}
                                </a>
                            </p>
                        </div>              
                    </div>
                    </#list>
					<button id="displaybtn" class="btn btn-default">展示</button>
				</div>
				<div class="table-products pagination">
      				<font class="title">共</font>
      					${root.page.totalPages}<font class="title">页　当前第 </font> 
     					${root.page.number}<font class="title">页</font>
     				<input type="hidden" id="number" value="${root.page.number}"/>  
      				<input type="button" class="btn-flat white" id="sy"  onclick="selectSy(${root.page.number},${root.page.totalPages})" value="首页"/>  
      				<input type="button" class="btn-flat white" id="syy" onclick="selectSyy(${root.page.number},${root.page.totalPages})" value="上一页 "/>  
      				<input type="button" class="btn-flat white" id="xyy" onclick="selectXyy(${root.page.number},${root.page.totalPages})" value="下一页"/>  
      				<input type="button" class="btn-flat white" id="wy"  onclick="selectWy(${root.page.number},${root.page.totalPages})" value="尾页 "/>  
      			</div>
				<!-- end table sample -->
			</div>
		</div>
		</form>
	</div>
</body>

<script src="${root.path}/js/jquery-latest.js"></script>
<script src="${root.path}/js/bootstrap.min.js"></script>
<script src="${root.path}/js/theme.js"></script>

<script type="text/javascript">
         var numpage = "1";
		//分页，应该传递pageCount
		 function selectSy(page,pageCount){  
             var page = page;  
             var pageCount = pageCount;  
             if(pageCount==0){  
                 alert("当前无数据");  
             }else if(page==1){     
                 alert("当前已是第一页");  
             } else {
             	 $("#number").val(1);
             	 var number = document.getElementById('number');
             	 numpage = number.value;
                 form1.action = "${root.path}/admin/showTeachers?numpage="+numpage;  
                 form1.submit();  
             };
         }  
         function selectSyy(page,pageCount){  
             var page = page;  
             var pageCount = pageCount;  
             if(pageCount==0){  
                 alert("当前无数据");  
             }else if(page==1){     
                 alert("当前已是第一页");  
             } else{  
                 $("#number").val(page-1);
                 var number = document.getElementById('number');
             	 numpage = number.value;
                 form1.action = "${root.path}/admin/showTeachers?numpage="+numpage;  
                 form1.submit();  
             }  ;
         }  
         function selectXyy(page,pageCount){  
             var page = page;  
             var pageCount = pageCount;  
             if(pageCount==0){  
                 alert("当前无数据");  
             }else if(page==pageCount){  
                 alert("当前已是最后一页");  
             }else{  
                 $("#number").val(page+1);
                 var number = document.getElementById('number');
             	 numpage = number.value;
                 form1.action = "${root.path}/admin/showTeachers?numpage="+numpage;
                 form1.submit();  
             }  ;
         }  
         function selectWy(page,pageCount){  
             var page = page;  
             var pageCount = pageCount;  
             if(pageCount==0){  
                 alert("当前无数据");  
             }else if(page==pageCount){  
                 alert("当前已是最后一页");  
             }else{ 
             	 $("#number").val(pageCount);
                 var number = document.getElementById('number');
             	 numpage = number.value;
                 form1.action = "${root.path}/admin/showTeachers?numpage="+numpage;  
                 form1.submit();  
             }  ;
         }
         
         <!--唐  5.25-->
		$("#displaybtn").click(function(){
	         var display = document.getElementsByName('display');
	         var userhomeworkid = "";
	         for(var i = 0;i < display.length;i++){
	         	if(display[i].checked){
	         		userhomeworkid += display[i].value + ",";
	         	}
         	}
	        <!--从 start 处到 stop-1 处的所有字符-->
	        var s = userhomeworkid.substring(0, userhomeworkid.length-1);
	        $.ajax({
	            url:"${root.path}/aAdmin/setDisply",
                data:{userhomeworkid:s},
            	type:"post",
            	dataType:"json",
            	async: false,
            	error:function() {
					alert('请求出错！');
				},
            	success:function(responseResult){
            		if(responseResult.flag){
            			alert("提交成功！");
            		}else{
            			alert("提交失败！");
            		}
            	}
         	});
	     });

		</script>
	</#if>
</html>